package com.jvm;

import java.util.ArrayList;
import java.util.List;

/**
 * JDK6下会出现
 * 运行时常量池溢出
 * Vm Args: -XX:PermSize=10M -XX:MaxPermSize=10M
 * @author zhuangqi
 * @@date 2017/3/30.
 */
public class RuntimeConstantpoolOOM {

    public static void main(String[] args) {
//        List<String> list = new ArrayList<>();
//        int i = 0;
//        while (true){
//            list.add(String.valueOf(i++).intern());
//        }
        String str1 = new StringBuilder("计算机").append("软件").toString();
        System.out.println(str1.intern() == str1);

        String str2 = new StringBuilder("ja").append("va").toString();
        System.out.println(str2.intern() == str2);

        String str3 = new StringBuilder("te").append("st").toString();
        System.out.println(str3.intern() == str3);
    }
}
